package com.walker.spring.main;

import com.walker.spring.config.ScopeConfig;
import com.walker.spring.service.scope.DemoPrototypeService;
import com.walker.spring.service.scope.DemoSingletonService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author qinmu
 * @create 2017-10-14-21:02
 */
public class ScopeMain {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScopeConfig.class);
        DemoSingletonService s1 = context.getBean(DemoSingletonService.class);
        DemoSingletonService s2 = context.getBean(DemoSingletonService.class);
        DemoPrototypeService p1 = context.getBean(DemoPrototypeService.class);
        DemoPrototypeService p2 = context.getBean(DemoPrototypeService.class);
        System.out.println(s1 == s2);
        System.out.println(p1 == p2);
    }
}
